<%@ page import="dao.IUserDao" %>
<%@ page import="dao.impl.UserDaoImpl" %>
<%@ page import="entity.Users" %><%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2019/4/4
  Time: 15:13
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<%
    request.setCharacterEncoding("UTF-8");
    response.setCharacterEncoding("UTF-8");
    String name=request.getParameter("username");
    String pwd=request.getParameter("password");
    IUserDao iud=new UserDaoImpl();
    Users u=iud.login(name,pwd);
    Users uid=iud.getUid(name);
    if (u!=null){
        session.setAttribute("user",uid);
        request.getRequestDispatcher("main.jsp").forward(request,response);
    }else {
        response.sendRedirect("login.html");
    }
%>

</body>
</html>
